<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/layui/assets/css/layui.css">
    <link rel="stylesheet" href="/static/layui/assets/css/admin.css">
    <link rel="stylesheet" href="/static/css/reveal.css">
    <link rel="icon" href="/favicon.ico">
    <title>管理后台</title>
</head>

<body class="layui-layout-body">

		<div id="myModal" class="reveal-modal">
			
			<h1>修改密码<h5 sec:authorize="hasRole('ROLE_ADMIN')">（系统管理员在修改密码时请做好密码备份，对自己修改的密码负责！）</h5></h1>
			<hr>
			<form action="editpassword" method="post">
			<div class="layui-form-item">
				<label class="layui-form-label">原密码</label>
				<div class="layui-input-inline">
				  <input type="password" name="password1" placeholder="请输入原密码" autocomplete="off" oninput="ymm(value)" class="layui-input" id="asb">
				</div>
				<div class="layui-form-mid layui-word-aux" id="ymmtext" ><font class="layui-icon layui-icon-password">请填写原密码</font></div> 
			</div> 
			
			<div class="layui-form-item">
				<label class="layui-form-label">新密码</label>
				<div class="layui-input-inline">
				  <input type="password" disabled="disabled" name="password2" id="asc" placeholder="请输入新密码" autocomplete="off" class="layui-input" oninput="xmm(value)">
				</div>
				<div class="layui-form-mid layui-word-aux" id="xmmtext"><font class="layui-icon layui-icon-password" ></font>请填写8位以上新密码</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">重复新密码</label>
				<div class="layui-input-inline">
				  <input type="password" disabled="disabled" name="password3" placeholder="请重复输入新密码" id="asd" autocomplete="off" class="layui-input" oninput="cmm(value)">
				</div>
				<div class="layui-form-mid layui-word-aux"  id="cmmtext"><font class="layui-icon layui-icon-password"></font>请重复新密码</div>
			</div>
			<a class="close-reveal-modal" onclick="remove()">&#215;</a>
			<button class="layui-btn layui-btn-disabled" id="button1" disabled="disabled" style="margin-left: 70%;">修改并注销</button>
			</form>
		</div>
		
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header custom-header">
            
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item slide-sidebar" lay-unselect>
                    <a href="javascript:;" class="icon-font"><i class="ai ai-menufold"></i></a>
                </li>
            </ul>

            <ul class="layui-nav layui-layout-right">
            	<li class="layui-nav-item" sec:authorize="!hasRole('ROLE_ADMIN')" >
            		<i class="layui-icon layui-icon-auz" style="color: #7fd96f">已授权</i>
            		<dl class="layui-nav-child">
            			<dd>&emsp;剩余<font th:text="${timea}" style="color: #7fd96f"></font>天&emsp;<dd>
                    </dl>
            	</li>
                <li class="layui-nav-item">
                    <a href="javascript:;"  >
                    	<i class="layui-icon layui-icon-username"></i>
                  		<span sec:authentication="principal.name">登陆成功</span>  
                    </a>
                    <dl class="layui-nav-child">
                    	<dd>
                        	<a href="/over" class="zhuxiao" sec:authorize="hasRole('ROLE_LESSEE')">个人资料</a>
						</dd>
                        <dd><a href="#" class="big-link" data-reveal-id="myModal" sec:authorize="!hasRole('ROLE_LESSEE')">修改密码</a></dd>
                        <dd><a href="#" class="big-link" data-reveal-id="myModal1" sec:authorize="hasRole('ROLE_LESSEE')">修改密码</a></dd>
                        
                        <dd>
                        	<a href="/over" class="zhuxiao">注销登录</a>
						</dd>
                    </dl>
                </li>
            </ul>
        </div>

        <div class="layui-side custom-admin">
            <div class="layui-side-scroll">

                <div class="custom-logo">
                    <img src="/static/layui/assets/images/logo.png" alt=""/>
                    <h1>发票管理系统</h1>
                </div>
                <div  sec:authorize="hasRole('ROLE_ADMIN')">
                <ul id="Nav" class="layui-nav layui-nav-tree">
                    <li class="layui-nav-item">
                        <a href="javascript:;">
                            <i class="layui-icon">&#xe609;</i>
                            <em>主页</em>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="console">导航栏</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">
                            <i class="layui-icon">&#xe857;</i>
                            <em >租户管理</em>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="users">租户授权新增操作</a></dd>
                            <dd><a href="trading">租户授权修改操作</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">
                            <i class="layui-icon">&#xe612;</i>
                            <em>操作日志</em>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="record">用户操作日志</a></dd>
                        </dl>
                    </li>
                </ul>
				</div>
			
				
				<div sec:authorize="hasRole('ROLE_LESSEE')">
                <ul id="Nav" class="layui-nav layui-nav-tree">
                    <li class="layui-nav-item">
                        <a href="javascript:;">
                            <i class="layui-icon">&#xe609;</i>
                            <em>主页</em>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="console">导航栏</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">
                            <i class="layui-icon">&#xe857;</i>
                            <em>管理</em>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="less/user">用户管理</a></dd>
                            <dd><a href="less/userpower">用户权限管理</a></dd>
                            <dd><a href="less/invoice">发票管理</a></dd>
                            
                        </dl>
                    </li>
                     <li class="layui-nav-item">
                        <a href="javascript:;">
                            <i class="layui-icon">&#xe665;</i>
                            <em>查看</em>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="less/recorde">查看历史授权记录</a></dd>
                        </dl>
                    </li>
                </ul>
				</div>
				
				<div sec:authorize="hasRole('ROLE_USER')">
                <ul id="Nav" class="layui-nav layui-nav-tree">
                    <li class="layui-nav-item">
                        <a href="javascript:;">
                            <i class="layui-icon">&#xe609;</i>
                            <em>主页</em>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="console">导航栏</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">
                            <i class="layui-icon">&#xe857;</i>
                            <em>电子发票</em>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="user/form">报销电子发票</a></dd>
                            <dd th:if="${guanli!=null}"><a href="user/eiminvoice">电子发票管理</a></dd>
                        	<dd><a href="user/userinvoice">查看电子发票信息</a></dd>
                        </dl>
                    </li>
                </ul>
				</div>
            </div>
        </div>

        <div class="layui-body">
             <div class="layui-tab app-container" lay-allowClose="true" lay-filter="tabs">
                <ul id="appTabs" class="layui-tab-title custom-tab"></ul>
                <div id="appTabPage" class="layui-tab-content"></div>
            </div>
        </div>
		
        <div class="layui-footer">
            <p>© 2018 发票管理系统：<a href="http://www.tgc.edu.cn/" target="_blank">版权所有</a></p>
        </div>

        <div class="mobile-mask"></div>
    </div>
    <div id="myModal1" class="reveal-modal">
		<h1>密码修改</h1><hr>
		<form action="userlogin/userpassword" method="post" id="form1">
			<div class="layui-form-item">
				<label class="layui-form-label">邮箱/账号</label>
				<div class="layui-input-inline">
				  <input type="email" id="imail1" name="qqnumber" placeholder="请输入您的电子邮箱" autocomplete="off" oninput="no1(value)" class="layui-input">
				</div>
				<div class="layui-form-mid layui-word-aux" id="text1" ><span class="layui-icon layui-icon-chat">请填写邮箱号</span></div> 
			</div> 
			
			<div class="layui-form-item">
				<label class="layui-form-label">验证码</label>
				<div class="layui-input-inline">
				  <input type="text" disabled="disabled" name="emain"  placeholder="请输入验证码" autocomplete="off" class="layui-input" id="text2" oninput="no2(value)">
				</div>
					<button type="button" class="layui-btn layui-btn-radius layui-btn-disabled" onclick="clickme111();" disabled="disabled" id="butt1" >获取邮箱</button>
				</div>
			
			
			<div class="layui-form-item displays1" style="display:none" >
				<label class="layui-form-label">输入密码</label>
				<div class="layui-input-inline">
					<input type="password"  name="passwor1" id="text3" placeholder="请输入密码" autocomplete="off" class="layui-input" oninput="xmm1(value)">				</div>
				<div class="layui-form-mid layui-word-aux"  id="xmmt"><font class="layui-icon layui-icon-password"></font>请输入密码</div>
			</div>
			
			<div class="layui-form-item displays1" style="display:none" >
				<label class="layui-form-label">确认密码</label>
				<div class="layui-input-inline">
				  <input type="password"  name="passwor2" placeholder="请重复输入密码" id="text4" autocomplete="off" class="layui-input" oninput="cmm1(value)">
				</div>
				<div class="layui-form-mid layui-word-aux"  id="cmmt"><font class="layui-icon layui-icon-password"></font>请确认密码</div>
			</div>
			<a class="close-reveal-modal" onclick="remove()">&#215;</a>
			<button type="button" class="layui-btn" id="but" style="margin-left: 70%;display:none" onclick="add1()">修改密码</button>
			</form>
		</div>
    <script src="/static/layui/assets/layui.js"></script>
    <script src="/static/layui/index.js" data-main="home"></script>
    <script type="text/javascript" src="/static/js/eim.js"></script>
    <script type="text/javascript" src="/static/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="/static/js/jquery.reveal.js"></script>
    <script src="http://www.jq22.com/js/jq.js"></script>	
    
</body>
<style type="text/css">
body { font-family: "HelveticaNeue","Helvetica-Neue", "Helvetica", "Arial", sans-serif; }
.big-link { display:block;}
</style>
<script type="text/javascript">
	function ymm(a){
		$.post('pwd?password='+a, function(data){
			if(! data){
				$("#asc").attr("disabled", true);
				$("#button1").attr("disabled", true);
				$("#button1").removeClass("layui-btn").addClass("layui-btn layui-btn-disabled");
			}else {
				$("#ymmtext").html('<font class="layui-icon layui-icon-ok-circle" style="color:#5fb878;"></font>正确');
				$("#asc").removeAttr("disabled");
			}
		});
	};
	function xmm(s){
		var str=s.length;
		if(str < 8){
			$("#xmmtext").html('<font class="layui-icon layui-icon-close-fill" style="color:#ff5722;"></font>密码少于8位！');
			$("#asd").attr("disabled", true);
			$("#button1").attr("disabled", true);
			$("#button1").removeClass("layui-btn").addClass("layui-btn layui-btn-disabled");
		}else{
			$("#xmmtext").html('<font class="layui-icon layui-icon-ok-circle" style="color:#5fb878;"></font>OK！');
			$("#asd").removeAttr("disabled");
		}
	};
	function cmm(s){
		var a=$("input[name='password2']").val();
		if(a != s||s ==null||s == ""){
			$("#cmmtext").html('<font class="layui-icon layui-icon-password"></font>请重复新密码');
			$("#button1").attr("disabled", true);
			$("#button1").removeClass("layui-btn").addClass("layui-btn layui-btn-disabled");
		}else{
			$("#cmmtext").html('<font class="layui-icon layui-icon-ok-circle" style="color:#5fb878;"></font>OK！');
			$("#button1").removeAttr("disabled");
			$("#button1").removeClass("layui-btn layui-btn-disabled").addClass("layui-btn");
		}
	}
	function remove(){
		$("#asb").val("");
		$("#asc").val("");
		$("#asd").val("");
		$("#asd").attr("disabled", true);
		$("#button1").attr("disabled", true);
		$("#button1").removeClass("layui-btn").addClass("layui-btn layui-btn-disabled");
		$("#asc").attr("disabled", true);
		$("#xmmtext").html('<font class="layui-icon layui-icon-password" ></font>请填写8位以上新密码');
		$("#cmmtext").html('<font class="layui-icon layui-icon-password"></font>请重复新密码');
		$("#ymmtext").html('<font class="layui-icon layui-icon-password">请填写原密码</font>');
	}
	
	
	
	
	
	
	
	function no1(value){
	    	$.post('admini/usern?usern='+value, function(data){
	    		if(! data){
	    			$("#text1").html('<span class="layui-icon layui-icon-chat">请填写邮箱号</span>');
	    	    	$("#butt1").attr("disabled", true);
	    			$("#butt1").removeClass("layui-btn layui-btn-radius").addClass("layui-btn layui-btn-radius layui-btn-disabled");
	    		}else{
		    		$("#text1").html('<font class="layui-icon layui-icon-ok-circle" style="color:#5fb878;"></font>OK！');
		    		$("#butt1").removeAttr("disabled");
					$("#butt1").removeClass("layui-btn layui-btn-radius layui-btn-disabled").addClass("layui-btn layui-btn-radius");
	    		}
	    	});
	};
	function clickme111(){
		var a=$("input[name='qqnumber']").val();
		$("#text2").removeAttr("disabled");
		as3(a);
		layer.msg('已发送验证码至您的邮箱，请注意查收！');
		$("#butt1").attr("disabled", true);
		$("#butt1").removeClass("layui-btn layui-btn-radius").addClass("layui-btn layui-btn-radius layui-btn-disabled");
		$.post('amil?emil='+a, function(data){
			var timer =60;
			if (timer >= 1) {
				var obj=$("#butt1").val()
		        timer -= 1;
				$("#butt1").html(timer+"秒后可重新获取 ");//禁用按钮
		        setTimeout(function() {
		        	clickme222(timer,obj);
		        }, 1000);
		    }else{
		    	
		    }
			
		});
	};
	function clickme222(timer,obj){
		if (timer >= 1) {
			var obj=$("#butt1").val()
	        timer -= 1;
	        $("#butt1").attr("disabled", true);
			$("#butt1").html(timer+"秒后可重新获取 ");//禁用按钮
	        setTimeout(function() {
	        	clickme222(timer,obj);
	        }, 1000);
	    }else{
	    	$("#text1").html('<font class="layui-icon layui-icon-ok-circle" style="color:#5fb878;"></font>OK！');
			$("#butt1").removeAttr("disabled");
			$("#butt1").html("获取邮箱 ");
			$("#butt1").removeClass("layui-btn layui-btn-radius layui-btn-disabled").addClass("layui-btn layui-btn-radius");
	    }
	};	
	function as3(value){
		$.post('userlogin/yanzhenma?usern='+value, function(data){
			if(! data){
				$(".displays1").hide();
				$("#butt").hide();
			}else {
				$(".displays1").show();
				$("#butt").show();
			}
		});
	};
	function no2(value){
		$.post('userlogin/yanzhenma?usern='+value, function(data){
			if(! data){
				$(".displays1").hide();
				$("#but").hide();
				
				$("#imail1").removeAttr("disabled");
				$("#text2").removeAttr("disabled");
			}else {
				$(".displays1").show();
				$("#but").show();
				$("#imail1").attr("disabled", true);
				$("#text2").attr("disabled", true);
			}
		});
	}
	function xmm1(s){
		var str=s.length;
		if(str < 8){
			$("#xmmt").html('<font class="layui-icon layui-icon-close-fill" style="color:#ff5722;"></font>密码少于8位！');
		}else{
			$("#xmmt").html('<font class="layui-icon layui-icon-ok-circle" style="color:#5fb878;"></font>OK！');
		}
	};
	function cmm1(s){
		var a=$("input[name='passwor1']").val();
		if(a != s||s ==null||s == ""){
			$("#cmmt").html('<font class="layui-icon layui-icon-password"></font>请确认密码');
		}else{
			$("#cmmt").html('<font class="layui-icon layui-icon-ok-circle" style="color:#5fb878;"></font>OK！');
			
		}
	}
	function add1(){
		var a1=$("input[name='qqnumber']").val();//邮箱
		var a2=$("input[name='passwor1']").val();
		var a3=$("input[name='passwor2']").val();
		var c=a2.length;
		if(a1!=""&&a2!=""&&a3!=""&&a3==a2&&c>7){
			$("#imail1").attr("disabled",false);
			$("#form1").submit()
		}else{
			layer.msg('输入存在错入！请核对！');
		}
	}
</script>
</html>